import axios from "@/utils/request";
import {Comments, GiveALike, Recommend, SecondComments} from "@/model/home/tease";

//保存用户的建议
export function saveRecommend(recommend: Recommend) {
    return axios({
        url: "/tease/recommend/web/saveRecommend",
        method: "post",
        data: recommend
    })
}

//查询当前用户是否已经提交建议
export function queryRecommendByUserId(userId: number) {
    return axios({
        url: "/tease/recommend/web/queryRecommendByUserId/" + userId,
        method: "get"
    })
}

//用户发表评论
export function saveComments(comments: Comments) {
    return axios({
        url: "/tease/comments/web/saveComments",
        method: "post",
        data: comments
    })
}

//获取所有评论
export function getCommentsList() {
    return axios({
        url: "/tease/comments/web/getCommentsList",
        method: "get"
    })
}

//点赞
export function like(giveALike: GiveALike) {
    return axios({
        url: "/tease/giveALike/web/like",
        method: "post",
        data: giveALike
    })
}

//根据用户id查询用户点赞信息
export function getGiveALikeList(userId: number) {
    return axios({
        url: "/tease/giveALike/web/getGiveALikeList/" + userId,
        method: "get"
    })
}

//保存二级评论
export function saveSecondComments(secondComments: SecondComments) {
    return axios({
        url: "/tease/secondComments/web/saveSecondComments",
        method: "post",
        data: secondComments
    })
}

//获取一级和二级评论
export function getFirstAndSecondComments() {
    return axios({
        url: "/tease/secondComments/web/getFirstAndSecondComments",
        method: "get",
    })
}